home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Sample Code / AOCE Sample Code / PowerTalk Access Modules / Sample SMSAM / SampleSMSAM Source / SampleSMSAMServer / StatusMonitor.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-07-28  |  2.6 KB  |  106 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        StatusMonitor.h
  3.  
  4.     Copyright:    © 1991-1994 by Apple Computer, Inc.
  5.                 All rights reserved.
  6.  
  7.     Part of the AOCE Sample SMSAM Package.  Consult the license
  8.     which came with this software for your specific legal rights.
  9.  
  10. */
  11.  
  12.  
  13.  
  14. #ifndef __STATUSMONITOR__
  15. #define __STATUSMONITOR__
  16.  
  17. #ifndef __BLJSTANDARDINCLUDES__
  18. #include "BLJStandardIncludes.h"
  19. #endif
  20.  
  21. #ifndef __OBJECTLIST__
  22. #include "ObjectList.h"
  23. #endif
  24.  
  25. #ifndef __BUFFER__
  26. #include "Buffer.h"
  27. #endif
  28.  
  29. #ifndef __UAPPLEEVENTS__
  30. #include "UAppleEvents.h"
  31. #endif
  32.  
  33. #pragma push
  34. #pragma segment StatusMonitor
  35.  
  36. const long cSupportMonitoring    = 9999;
  37. const long cStatusLogInit         = 99;
  38. const long cItemsToBeMonitored     = 100;
  39. const long cStopMonitoring         = 101;
  40. const long cStatusSessionAlive  = 102;
  41. const long cMonitorCommand        = 103;
  42. const long cSetConfigCommand     = 104;
  43. const long cGetConfigCommand     = 105;
  44.  
  45. DeclareList(ABuffer,TBufferList);
  46.  
  47. /***********************************|****************************************/
  48.  
  49. class TSession : public THandleObject 
  50. {
  51. public:
  52.             TSession ( const TAddressDescription&, long theSessionID );
  53.     virtual ~TSession();
  54.  
  55.             TAddressDescription&     GetAddress();
  56.             long                     GetSessionID() const;
  57.  
  58.             void                     SetItemValue ( TBufferList* );
  59.             unsigned long             CountItems() const;
  60.             long                     GetItemValue(unsigned long index) const;
  61.  
  62.             Boolean                 HasTimerExpired() const;
  63.             void                     ResetTimer();
  64.  
  65. protected:    TAddressDescription     fAddress;
  66.             long                    fSessionID;
  67.             TBufferList*            fMonitorList;
  68.             unsigned long            fPeriodicCheckSessionAlive;
  69. };
  70.  
  71. DeclareList(TSession,TSessionList);
  72.  
  73. /***********************************|****************************************/
  74.  
  75. class TMailGateway;
  76.  
  77. class TStatusMonitor : public TDirectObject 
  78. {
  79. public:
  80.             TStatusMonitor(TMailGateway* gateway);
  81.     virtual ~TStatusMonitor();
  82.     
  83.             void                     HandleAppleEvents(const AppleEvent& message,const AppleEvent& reply, long info);
  84.             OSErr                     Run ();
  85.  
  86.             void                     UpdateMonitor();
  87.             void                     UpdateLog(long infoID, char* theMsg);
  88.             TSession*                FindMatchingSession(const TAddressDescription& theAddress, long docSessionID) const;
  89.  
  90. protected:    thread*                    fMonitorThread;
  91.             TMailGateway*            fMailGateway;
  92.             TSessionList            fSessionList;
  93. };
  94.  
  95. /***********************************|****************************************/
  96.  
  97. inline unsigned long TSession::CountItems() const { return fMonitorList ? fMonitorList->Count () : 0; }
  98. inline TAddressDescription& TSession::GetAddress() { return fAddress; }
  99. inline long TSession::GetSessionID() const { return fSessionID; }
  100.  
  101. /***********************************|****************************************/
  102.  
  103. #pragma pop
  104.  
  105. #endif    // __STATUSMONITOR__
  106.